package xyz.xtt.admin.comAnnotation;

import org.springframework.stereotype.Component;
import xyz.xtt.admin.comAnnotation.impl.EqualsValueValidator;

import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.*;

/**
 * 检验参数值
 *
 * @author xugaopeng
 * @date 2024/12/16 10:45
 **/
@Component
@Constraint(validatedBy = EqualsValueValidator.class)
@Target({ElementType.FIELD, ElementType.PARAMETER,ElementType.TYPE,ElementType.METHOD,ElementType.TYPE_USE, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface EqualsValues {
    String message() default "The value must be equal to specified value.";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    String[] anyof(); // The array of allowed values.
}

